﻿using WMLogistics.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dapper;

namespace WMLogistics_Dao
{
    public class CompanySaleDao
    {
        public IEnumerable<wuliu_company_sales> GetSales(int company_id)
        {
            var sql = "select * from wuliu_company_sales where company_id=@company_id and state=1";
            using (var conn = ConnectionHelper.OpenConnection())
            {
               return conn.Query<wuliu_company_sales>(sql, new { company_id });
            }
        }

        public void Add(wuliu_company_sales sale)
        {
            var sql = @"insert into wuliu_company_salse(company_id,sales_name,sales_phone,state)
values(@company_id,@sales_name,@sales_phone,@state)";
            using (var conn = ConnectionHelper.OpenConnection())
            {
                 conn.Execute(sql, new { sale });
            }
        }
    }
}
